using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.Reporting.WebForms;
using SajtLibrary.SajtClasses;
using SajtLibrary;

public partial class Public_IzdavanjeRacuna :  System.Web.UI.Page, IAuthorizationChecker
{ 

    ReseatDataSet reseatDataSet = new ReseatDataSet();

    protected void Page_Load(object sender, EventArgs e)
    {
        LocalReport rep = ReportViewer1.LocalReport;
        rep.DataSources.Clear();
        reseatDataSet.Clear();
        ///
        /// Primer dohvatanja informacija o racunu iz DB
        /// IList<stavkeRacuna> sr = QE.ecuteQuery("dohvati racun 123")

        reseatDataSet.Racun.AddRacunRow("1234", "2010-03-12 12:03:55");
        reseatDataSet.StavkeRacuna.AddStavkeRacunaRow("1234", "Bluetooth", "2", "100");
        reseatDataSet.StavkeRacuna.AddStavkeRacunaRow("1234", "Laptop", "1", "100");
        rep.DataSources.Add(new ReportDataSource("ReseatDataSet_Racun", reseatDataSet.Racun));
        rep.DataSources.Add(new ReportDataSource("ReseatDataSet_StavkeRacuna", reseatDataSet.StavkeRacuna));

        /*
        if (HttpContext.Current.User.Identity.IsAuthenticated)
        {
            HttpContext.Current.Response.Write("Ima korisnika");
        }
        else
        {
            HttpContext.Current.Response.Write("Nema korisnika " + HttpContext.Current.User.Identity.Name);
            HttpContext.Current.Session.Add("username", "Pera");
        }
        */
    }


    #region IAuthorizationChecker Members

    public bool checkAutorization(User user)
    {
        return user.IsClient;
    }

    #endregion
}
